home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1987 February / Ahoy_Magazine_87-02_1987_Double_L.d64 / The Adventurer (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  6KB  |  290 lines

  1. 10 rem load screen & title
  2. 11 :
  3. 20 poke53280,0:poke53281,0
  4. 30 print"[147]";
  5. 40 printtab(12)"[153]the adventurer"
  6. 50 printtab(9)"[150]by jean-francois heon"
  7. 60 printtab(11)"joystick in port#2"
  8. 70 printtab(13)"please wait..."
  9. 80 ifa=0thena=1:load"dj",8,1
  10. 99 :
  11. 100 rem variables
  12. 101 :
  13. 110 dim scr(2,3),it(2,3,1),nm(2,3)
  14. 120 block=16384:sh=1:mt=1:k=1:s=54272
  15. 130 x=7:y=7:x1=0:y1=0:v=2:m=4:man=1
  16. 140 fori=0to2:forj=0to3
  17. 150 scr(i,j)=v:v=v+1
  18. 160 readd:it(i,j,0)=d
  19. 170 readd:it(i,j,1)=d
  20. 175 readd:nm(i,j)=d
  21. 180 next j,i
  22. 185 data 12,6,1,4,9,9,8,18,11,32,6,4
  23. 190 data 12,3,5,16,12,7,20,9,8,32,12,6
  24. 195 data 4,15,3,4,18,10,28,9,12,28,12,2
  25. 199 :
  26. 200 rem initialition
  27. 201 :
  28. 210 fori=55295to56255:pokei,9:next
  29. 215 forl=stos+24:pokel,0:next
  30. 220 poke56578,peek(56578)or3
  31. 230 poke56576,(peek(56576)and252)or2
  32. 240 poke53272,(peek(53272)and240)or14
  33. 250 gosub 6000
  34. 260 po=block+1024*scr(y1,x1)+x+y*40
  35. 270 co=55296+x+y*40
  36. 280 poke po,74:pokeco,1
  37. 999 :
  38. 1000 rem man moves
  39. 1001 :
  40. 1005 if man=0thengosub5000:goto7000
  41. 1010 j=peek(56320)
  42. 1020 if(jand16)=0 then 3000
  43. 1030 if(jand1)=0 thenm=1:mv=-40:goto1080
  44. 1040 if(jand2)=0 thenm=2:mv=40:goto1080
  45. 1050 if(jand4)=0 thenm=3:mv=-1:goto1080
  46. 1060 if(jand8)=0 thenm=4:mv=1:goto1080
  47. 1070 goto 2000
  48. 1080 on m goto 1100,1120,1140,1160
  49. 1090 goto 1200
  50. 1100 ify-1=-1theny=24:pokepo,32:pokeco,9:y1=y1-1:gosub6000:goto 1200
  51. 1110 goto 1170
  52. 1120 ify+1=24theny=-1:pokepo,32:pokeco,9:y1=y1+1:gosub6000:goto 1200
  53. 1130 goto 1170
  54. 1140 ifx-1=-1thenx=40:pokepo,32:pokeco,9:x1=x1-1:gosub6000:goto 1200
  55. 1150 goto 1170
  56. 1160 ifx+1=40thenx=-1:pokepo,32:pokeco,9:x1=x1+1:gosub6000:goto 1200
  57. 1170 if peek(po+mv)>64andpeek(po+mv)<70 then2000
  58. 1180 if peek(po+mv)=76 and k=nm(y1,x1)then gosub 4500:goto 1200
  59. 1190 if peek(po+mv)=76 then gosub4520:goto2000
  60. 1195 if peek(po+mv)>76andpeek(po+mv)<80 then gosub5000:goto7000
  61. 1200 on m gosub 1220,1230,1240,1250
  62. 1210 goto 1260
  63. 1220 y=y-1:return
  64. 1230 y=y+1:return
  65. 1240 x=x-1:return
  66. 1250 x=x+1:return
  67. 1260 pq=po:cq=co
  68. 1270 po=block+1024*scr(y1,x1)+x+y*40
  69. 1280 co=55296+x+y*40
  70. 1290 poke co,1
  71. 1300 on m gosub 1330,1330,1350,1370
  72. 1310 poke pq,32:poke cq,9:gosub 4000
  73. 1320 goto 2000
  74. 1330 poke po,71+sh:sh=sh+1:ifsh=3thensh=1
  75. 1340 return
  76. 1350 poke po,69+sh:sh=sh+1:ifsh=3thensh=1
  77. 1360 return
  78. 1370 poke po,73+sh:sh=sh+1:ifsh=3thensh=1
  79. 1380 return
  80. 1999 :
  81. 2000 rem monster moves
  82. 2001 :
  83. 2010 mv=0
  84. 2020 if mt=0 then 2500
  85. 2030 if x<a then mm=1:mv=-1:goto2070
  86. 2040 if x>a then mm=2:mv=1:goto2070
  87. 2050 if y<b then mm=3:mv=-40:goto2070
  88. 2060 if y>b then mm=4:mv=40
  89. 2070 if peek(pm+mv)>64 and peek(pm+mv)<70 then 1000
  90. 2080 if peek(pm+mv)>69 and peek(pm+mv)<76 then man=0
  91. 2090 if peek(pm+mv)=76 then 1000
  92. 2100 on mm gosub 2120,2130,2140,2150
  93. 2110 goto 2160
  94. 2120 a=a-1:return
  95. 2130 a=a+1:return
  96. 2140 b=b-1:return
  97. 2150 b=b+1:return
  98. 2160 pw=pm:cw=cm
  99. 2170 pm=block+1024*scr(y1,x1)+a+b*40
  100. 2180 cm=55296+a+b*40
  101. 2190 poke cm,13
  102. 2200 poke pm,76+mt:mt=mt+1:ifmt=4thenmt=1
  103. 2210 poke pw,32:poke cw,9
  104. 2220 goto 2500
  105. 2499 :
  106. 2500 rem score & key sub-routine
  107. 2501 :
  108. 2510 print"";
  109. 2520 print"[158]score:"sctab(20)"[153]key number:"k""
  110. 2530 goto 1000
  111. 2999 :
  112. 3000 rem shoot routine
  113. 3001 :
  114. 3005 gosub 3600:rem sound
  115. 3010 on m goto 3020,3100,3180,3260
  116. 3020 if y=0 then 2000
  117. 3030 d=y-5:ifd<0thend=0
  118. 3040 for i=y-1 to d step-1
  119. 3050 if i<y-1 then pe=pt:ce=ct
  120. 3060 pt=block+1024*scr(y1,x1)+x+i*40
  121. 3070 ct=55296+x+i*40
  122. 3080 goto 3500
  123. 3090 :
  124. 3100 if y=23 then 2000
  125. 3110 d=y+5:ifd>23thend=23
  126. 3120 for i=y+1 to d
  127. 3130 if i>y+1 then pe=pt:ce=ct
  128. 3140 pt=block+1024*scr(y1,x1)+x+i*40
  129. 3150 ct=55296+x+i*40
  130. 3160 goto 3500
  131. 3170 :
  132. 3180 if x=0 then 2000
  133. 3190 d=x-5:ifd<0thend=0
  134. 3200 for i=x-1 to d step-1
  135. 3210 if i<x-1 then pe=pt:ce=ct
  136. 3220 pt=block+1024*scr(y1,x1)+i+y*40
  137. 3230 ct=55296+i+y*40
  138. 3240 goto 3500
  139. 3250 :
  140. 3260 if x=39 then 2000
  141. 3270 d=x+5:ifd>39thend=39
  142. 3280 for i=x+1 to d
  143. 3290 if i>x+1 then pe=pt:ce=ct
  144. 3300 pt=block+1024*scr(y1,x1)+i+y*40
  145. 3310 ct=55296+i+y*40
  146. 3320 goto 3500
  147. 3330 :
  148. 3500 if peek(pt)>64 and peek(pt)<70 theni=d:goto 3560
  149. 3510 if peek(pt)>76 and peek(pt)<80 and mt<>0 theni=d:mt=0:sc=sc+50:goto 3530
  150. 3520 if peek(pt)=76 then i=d:goto 3560
  151. 3530 poke pt,79+m:poke ct,15
  152. 3540 fort=0to50:next
  153. 3550 poke pe,32:poke ce,9
  154. 3560 next:if peek(pe)>79 then poke pe,32:poke ce,9
  155. 3570 if peek(pt)>79 then poke pt,32:poke ct,9
  156. 3580 pokes+4,128:pokes+24,0:goto 2000
  157. 3600 pokes+24,15
  158. 3610 pokes+5,15:pokes+6,255
  159. 3620 pokes+1,30:pokes,0
  160. 3630 pokes+4,129
  161. 3640 return
  162. 3999 :
  163. 4000 rem man sound sub-routine
  164. 4001 :
  165. 4010 pokes+5,0:pokes+6,15
  166. 4020 pokes+24,15
  167. 4030 pokes+1,30:pokes,0
  168. 4040 pokes+4,129
  169. 4050 pokes+4,128
  170. 4060 pokes+24,0
  171. 4070 return
  172. 4499 :
  173. 4500 rem key sound sub-routine
  174. 4501 :
  175. 4510 k=k+1:sc=sc+100:nm(y1,x1)=0
  176. 4520 pokes+5,15:pokes+6,255
  177. 4530 pokes+24,15
  178. 4540 pokes+1,244:pokes,103
  179. 4550 pokes+4,17
  180. 4560 fort=1to7:pokes+24,15-t*2
  181. 4570 fori=1to250:nexti,t
  182. 4580 pokes+4,16
  183. 4590 pokes+24,0
  184. 4600 return
  185. 4999 :
  186. 5000 rem dead sound sub-routine
  187. 5001 :
  188. 5005 s=54272
  189. 5010 pokes+5,244:pokes+6,103
  190. 5020 pokes+24,15
  191. 5030 pokes+1,244:pokes,0
  192. 5040 pokes+4,129
  193. 5050 fori=1to7000:next
  194. 5060 pokes+4,128
  195. 5100 pokes+24,0
  196. 5110 return
  197. 5999 :
  198. 6000 rem ghange screen sub-routine
  199. 6001 :
  200. 6005 poke px,32:poke cx,9:poke pm,32:poke cm,9:mt=1
  201. 6010 poke53272,(peek(53272)and15)orscr(y1,x1)*16
  202. 6020 v=block+1024*scr(y1,x1)
  203. 6030 poke 648,int(v/256)
  204. 6032 print"                                      ";
  205. 6033 ifx1=0andy1=0andk=13 then 8000
  206. 6034 ifk=13 then 6070
  207. 6035 if nm(y1,x1)=0 then mt=0:return
  208. 6040 px=block+1024*scr(y1,x1)+it(y1,x1,0)+it(y1,x1,1)*40
  209. 6050 cx=55296+it(y1,x1,0)+it(y1,x1,1)*40
  210. 6060 poke px,76:pokecx,1
  211. 6070 a=it(y1,x1,0)+1:b=it(y1,x1,1)+1
  212. 6080 pm=block+1024*scr(y1,x1)+a+b*40
  213. 6090 cm=55296+a+b*40
  214. 6100 poke pm,77:pokecm,13
  215. 6110 return
  216. 6999 :
  217. 7000 rem game over
  218. 7001 :
  219. 7005 pokepo,32:pokepx,32:pokepm,32
  220. 7010 poke56578,peek(56578)or3
  221. 7020 poke56576,(peek(56576)and252)or3
  222. 7030 poke53272,(peek(53272)and240)or4
  223. 7040 poke53272,(peek(53272)and15)or16
  224. 7050 poke 648,4
  225. 7060 print"[147]";
  226. 7070 printtab(14)"game over"
  227. 7080 printtab(5)"(press a key for a new game)"
  228. 7090 geta$:ifa$=""then7090
  229. 7100 printtab(5)"[145]                            "
  230. 7110 clr:restore:goto 100
  231. 7999 :
  232. 8000 rem you won!
  233. 8001 :
  234. 8010 poke56578,peek(56578)or3
  235. 8020 poke56576,(peek(56576)and252)or3
  236. 8030 poke53272,(peek(53272)and240)or4
  237. 8040 poke53272,(peek(53272)and15)or16
  238. 8050 poke 648,4
  239. 8060 print"[147]";
  240. 8070 print"you are opening the door..."
  241. 8080 gosub 4500
  242. 8090 print"[147]";
  243. 8130 printtab(16)"[155][169]    [223]"
  244. 8140 printtab(16)"[152]      "
  245. 8150 printtab(16)"[152]      "
  246. 8160 printtab(15)"[155][169]      [223]"
  247. 8170 printtab(15)"[152]        "
  248. 8180 printtab(15)"[152]        "
  249. 8190 printtab(14)"[155][169]        [223]"
  250. 8200 printtab(14)"[152]          "
  251. 8210 printtab(14)"[152]          "
  252. 8220 printtab(13)"[155][169]          [223]"
  253. 8230 printtab(13)"[152]            "
  254. 8240 printtab(13)"[152]            "
  255. 8250 printtab(12)"[155][169]            [223]"
  256. 8260 printtab(12)"[152]              "
  257. 8270 printtab(12)"[152]              "
  258. 8280 printtab(11)"[155][169]              [223]"
  259. 8290 printtab(11)"[152]                "
  260. 8300 printtab(11)"[152]                "
  261. 8310 printtab(10)"[155][169]                [223]"
  262. 8320 printtab(10)"[152]                  "
  263. 8330 printtab(10)"[152]                  "
  264. 8335 printtab(9)"[155][169] you're escaping  [223]";
  265. 8340 x$="    [157][157][157][157]"
  266. 8350 a$=x$+x$+x$
  267. 8360 x$="      [157][157][157][157][157][157]"
  268. 8370 b$=x$+x$+x$+x$+x$
  269. 8380 x$="        [157][157][157][157][157][157][157][157]"
  270. 8390 c$=x$+x$+x$+x$+x$+x$
  271. 8400 x$="          [157][157][157][157][157][157][157][157][157][157]"
  272. 8410 d$=x$+x$+x$+x$+x$+x$+x$
  273. 8420 x$="            [157][157][157][157][157][157][157][157][157][157][157][157]"
  274. 8423 y$="    the     [157][157][157][157][157][157][157][157][157][157][157][157]"
  275. 8425 z$="    end     [157][157][157][157][157][157][157][157][157][157][157][157]"
  276. 8430 e$=x$+x$+x$+y$+z$+x$+x$+x$
  277. 8480 a=17:b=16:c=15:d=14:e=13:f=12:g=11:poke646,14
  278. 8490 x=a:y=0:gosub 9000:print""a$:gosub9000:gosub9020:gosub4000:print"[146]"a$
  279. 8500 x=b:y=1:gosub 9000:print""b$:gosub9000:gosub9020:gosub4000:print"[146]"b$
  280. 8510 x=c:y=3:gosub 9000:print""c$:gosub9000:gosub9020:gosub4000:print"[146]"c$
  281. 8520 x=d:y=5:gosub 9000:print""d$:gosub9000:gosub9020:gosub5000
  282. 8525 gosub9000:gosub9020:gosub4000:print"[146]"d$
  283. 8530 x=e:y=7:gosub 9000:print""e$
  284. 8560 x=0:y=24:gosub9000
  285. 8570 printtab(9)"[155][169]     maybe...     [223]";
  286. 8580 goto8580
  287. 9000 poke782,x:poke781,y:sys 65520
  288. 9010 return
  289. 9020 fori=1to1000:next:return
  290.